﻿<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>网站后台内容管理系统登录登陆界面模板 - cssmoban</title>
<meta name="keywords" content="后台登陆页面模板,后台登录界面html,后台登录模板,后台登录页面html,后台管理系统后台登录模板">
<meta name="description" content="cssmoban提供后台管理系统登录界面html模板学习和下载">
<meta name="viewport" content="width=device-width">
<link href="public/css/base.css" rel="stylesheet" type="text/css">
<link href="public/css/login.css" rel="stylesheet" type="text/css">
</head>
<body>

<div class="login">
<form action="" method="post" id="form">
	<div class="logo"></div>
    <div class="login_form">
    	<div class="user">
        	<input class="text_value" value="" name="username" type="text" id="username">
            <input class="text_value" value="" name="password" type="password" id="password">

        </div>
        <button class="button" id="submit" type="button">登录</button>
    </div>
	<span id="msg" style="margin: 0 auto;color: red"></span>
    <div id="tip"></div>
    <div class="foot">
    Copyright © 2011-2015  All Rights Reserved. More Templates <a href="http://www.cssmoban.com/" target="_blank" title="模板之家">模板之家</a> - Collect from <a href="http://www.cssmoban.com/" title="网页模板" target="_blank">网页模板</a>
    </div>
    </form>
</div>
<script src="../../assets/js/jquery.min.js"></script>
<script>
	$(function() {
		$("#submit").click(function(){
			var userName = $("#username").val();
			var password = $("#password").val();
			var data = {"userName":userName,"password":password};

			$.ajax({
				url:"/user/doLogin",
				type:"post",
				dataType:"json",
				data:data,
				success:function(result){
					console.log("用户："+result.data)
					if(result.data == null){
						$("#msg").html("用户名或密码有误，请重新填写。");
					}else{	// 登录成功
						window.location.href="/";
					}

				},error:function(){
					console.log("登录异常");
				}
			})
		});
	});



</script>
</body>
</html>
